﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T12OOP
{
    class Student
    {
        private string name;

        private int age;

        public string Name {
            get { return name; }
            set { name = value; }

        }
        private int age;

        public int Age
        {
            get { return age; }
            set {
                if (value <=0|value >100)
                    throw new AggregateException("年龄参数异常") 
                age= value; }
        }

        public override string ToString()
        {
            return string.Format("{0}:{1}",name ,age );
            
        }

    }
}
